<?php

class Benchmark {
	private $start = null;
	private $end = null;
		
	function start() {
		$this->start = microtime(1);
	}
	
	function end() {
		$this->end = microtime(1);
	}
	
	function getTimeDiff() {
		if($this->start == null || $this->end == null) {
			throw new Exception('Both the start() and end() functions must be called for before getTimeDiff().');
		}
		return $this->end - $this->start;
	}
}
?>